package com.proposition.paper.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.proposition.commons.model.ExamAcupoint;
import com.proposition.commons.model.ExamAnswer10;
import com.proposition.commons.model.Paper;
import com.proposition.commons.model.PaperExam;
import com.proposition.paper.mapper.PaperExamMapper;
import com.proposition.paper.service.PaperExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 试卷导出--问答
 *
 * @author 杨凯
 * @create 2018-04-16 10:58
 **/
@Service("exportWenDa")
public class PaperExportWenDaServiceImpl implements PaperExportService{

	@Autowired
	private PaperExamMapper paperExamMapper;
	@Override
	public Map<String, Object> getPaperAndAnswerById(String paperId) {
		Map<String,Object> map = new HashMap<>(3);
		PaperExam paperExam = new PaperExam();
		paperExam.setPaperId(paperId);
		//查询试卷对应试题
		paperExam = paperExamMapper.selectOne(paperExam);
		//获取试题详情
		ExamAcupoint examAcupoint = new ExamAcupoint().selectOne(new EntityWrapper().eq("id", paperExam.getExam1()));
		map.put("exam1", examAcupoint);
		ExamAnswer10 answer10 = new ExamAnswer10().selectOne(new EntityWrapper().eq("id",  paperExam.getExam2()));
		map.put("exam2", answer10);
		answer10 = new ExamAnswer10().selectOne(new EntityWrapper().eq("id",  paperExam.getExam3()));
		map.put("exam3", answer10);
		return map;
	}
}
